<?php (!defined('IN_SYSTEM') || !defined('ADMIN_PRE')) && exit('Access Denied!');?>
{admintemplate header}
<div class="box">
	<div class="heading">
	<h1>附件管理</h1>
	</div>
	<div class="main">
		
		<div class="search">
			<form name="search" method="POST" action="{url admin.php?m=attachment}" autocomplete="off">
				<fieldset>
					<legend>附件查找</legend>
						日期：
						{get_date_options($year, $month, $day)}
						扩展名：
						<select name="fileext">
						<option value="">所有</option>
						{get_fileext_options($fileext)}
						</select>
						缩略图：
						<select name="thumb">
						<option value="">所有</option>
						<option value="1" {if $thumb == 1}selected="selected"{/if}>有</option>
						<option value="2" {if $thumb == 2}selected="selected"{/if}>无</option>
						</select>
						文件名：
						<input type="text" name="keyword" size="15" value="{urldecode($keyword)}" />
						<input type="submit" name="s" class="button" value="开始查找" />
						<input type="button" class="button" value="显示全部" onclick="javascript:window.location.href='{url admin.php?m=attachment}';" />
				</fieldset>
			</form>
		</div>
		
		<form name="op" method="post" action="{url admin.php?m=attachment&f=delete}" autocomplete="off">
			<table cellspacing="0" class="list" id="list">
			<thead>
				<tr>
					<td width="1"><input type="checkbox" name="chkall" id="chkall" value="1" class="checkbox" onclick="check_all(this)" /></td>
					<td width="50">
					{if getGP('id','G') == 'asc'}
					<a href="{url $url&id=desc}" title="按ID从大到小排序">ID↑</a>
					{else}
						<a href="{url $url&id=asc}" title="按ID从小到大排序">ID↓</a>
					{/if}
					</td>
					<td class="left">文件名</td>
					<td>文件地址</td>
					<td width="50">缩略图</td>
					<td width="90">
					{if getGP('filesize','G') == 'asc'}
						<a href="{url $url&filesize=desc}" title="从大到小排序">文件大小↓</a>
					{else}
						<a href="{url $url&filesize=asc}" title="从小到大排序">文件大小↑</a>
					{/if}
					</th>
					<td width="150">上传时间</td>
					<td width="80">
					{if getGP('downloads','G') == 'asc'}
						<a href="{url $url&downloads=desc}" title="从多到少排序">下载次数↓</a>
					{else}
						<a href="{url $url&downloads=asc}" title="从少到多排序">下载次数↑</a>	
					{/if}
					</td>
				</tr>
				</thead>
				<tbody>
				{loop $result $row}
				<tr id="row_{$row['id']?>">
					<td align="center">
					<input type="checkbox" name="id[]" value="{$row['fid']?>" class="checkbox" />
					</td>
					<td align="center">{$row['fid']}</td>
					<td class="left">{$row['originalname']}</td>
					<td><a href="{echo DATA_DIR}files/{$row['filepath']}" title="查看附件" target="_blank">{$row['filepath']}</a></td>
					<td align="center">
					{if !empty($row['thumb'])}
					<a href="{echo DATA_DIR}files/{$row['thumb']}" title="查看缩略图" target="_blank">查看</a>
					{else}<span style="color:gray">无</span>{/if}
					</td>
					<td align="center">{sizecount($row['filesize'])}</td>
					<td align="center">{gdate('Y-m-d H:i',$row['dateline'])}</td>
					<td align="center"><b>{$row['downloads']}</b></td>
				</tr>
				{/loop}
				<tr>
					<td align="center">
					<input type="checkbox" name="chkall" id="chkall" value="1" class="checkbox" onclick="check_all(this)" /></td>
					<td class="left"><label for="chkall">全选</label></td>
					<td colspan="6">{pager($num,$pagesize,$page,$url)}
					<input type="submit" class="button" value="删除附件" />
					</td>
				</tr>
			</tbody>	
			</table>		
		</form>
	</div>
</div>
{admintemplate footer}